package com.itlaobing.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

public class AnnoTest1 {

    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {

        Human h = new Human();
        Class<?> c = Human.class;

        Field f = c.getDeclaredField("name");
        System.out.println("f"+f);

        Assign a = f.getDeclaredAnnotation(Assign.class);

        String n = a.value();
        System.out.println("n"+n);

        f.setAccessible(true);
        f.set(h,n);

        h.eat( "海底捞火锅" );
    }
}
